<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>修改密码页面</title>
<script type="text/javascript" src="<c:url value='/admin/js/util/jquery-1.8.1.min.js' />" ></script>
<script type="text/javascript" src="<c:url value='/admin/js/util/validate.js' />" ></script>
<link href="<c:url value='/admin/css/general.css' />" rel="stylesheet" type="text/css" />
<script language="javascript">
function addCustomers(o,a,b){ 
	var t=document.getElementById(o).getElementsByTagName("tr"); 
	for(var i=0;i<t.length;i++){ 
		t[i].style.backgroundColor=(t[i].sectionRowIndex%2==0)?a:b; 
		t[i].onmouseout=function(){ 
			if(this.x!="1")this.style.backgroundColor=(this.sectionRowIndex%2==0)?a:b; 
		};
	}
}

function submitForm() {
	if(validate()){
		$("#mainForm").attr("action", "<c:url value='/admin/adminUserAction!modifySelfPwdExc.do' />");
		$("#mainForm").submit();
	}
}

function validate() {
	if (!validateLength("adminUserPassword",4,20,"原密码最少四位，请重新输入！","请输入短一点的原密码！"))
		return false;
	if (!validateLength("newPassword",4,20,"新密码最少四位，请重新输入！","请输入短一点的新密码！"))
		return false;
	if (!validateLength("checkPassword",4,20,"确认密码最少四位，请重新输入！","请输入短一点的确认密码！"))
		return false;
	if ($("#newPassword").val() != $("#checkPassword").val()) {
		alert("新密码和确认密码不一致！");
		return false;
	}
	return true;
}
</script>
</head>
<body>
	<form id="mainForm" action="" method="post">
		<input type="hidden" name="adminUser.id" value="${ adminUser.id }" />
	
		<div class="tableTitle">修改密码</div>
		<table width="100%" cellspacing="1" id="addCustomers">
			<tr>
				<th colspan="2">注：带<b>*</b>号的为必填项
				</th>
			</tr>
			<tr>
				<td><span>用户名：</span><input type="text" value="${ adminUser.loginName }" disabled="disabled"/></td>
			</tr>
			<tr>
				<td><span>原密码<b>*</b>：</span><input name="adminUser.password" id="adminUserPassword" type="password" value="" maxlength="20"/></td>
			</tr>
			<tr>
				<td><span>新密码<b>*</b>：</span><input name="newPassword" id="newPassword" type="password" value="" maxlength="20"/></td>
			</tr>
			<tr>
				<td><span>确认密码<b>*</b>：</span><input name="checkPassword" id="checkPassword" type="password" value="" maxlength="20"/></td>
			</tr>
			<tr>
				<td><a href="javascript:submitForm();">保存</a> <a href="javascript:document.getElementById('mainForm').reset();">重置</a></td>
			</tr>
		</table>
	</form>
	<script language="javascript">
	//addCustomers("表格名称","奇数行背景","偶数行背景","鼠标经过背景","点击后背景"); 
	addCustomers("addCustomers","#fff","#F6F6F6");
	</script>
</body>
</html>